/**
 * Created with JetBrains PhpStorm.
 * User: Kame
 * Date: 29/03/13
 * Time: 11:44 AM
 */

$(document).ready(function () {
    masterButtons = $('.masterbutton');
    masterButtons.each(function(index,el){
       $(el).click(function(event){
           var elt = this;
           event.preventDefault();
           contentUrl    = $(elt).attr('data-url');
           if ($(elt).data("executing"))
               return;
           $(elt).data("executing",true);
           $("#main-container").fadeOut(500, function(){
                $("#main-container").load(contentUrl, function(){
                    $(elt).removeData("executing");
                    $("#main-container").fadeIn(500);
                });
           });
       });
    });
});